package com.app.biz.service.impl;

import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
import com.app.biz.mapper.BizIndustrialDataMapper;
import com.app.biz.service.IBizIndustrialDataService;
import com.app.common.core.domain.AjaxResult;
import com.app.common.utils.StringUtils;
import com.app.biz.domain.BizIndustrialData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BizIndustrialDataServiceImpl implements IBizIndustrialDataService {

    @Autowired
    private BizIndustrialDataMapper bizIndustrialDataMapper;

    /**
     *
     */
    @Override
    public List<BizIndustrialData> selectIndustrialDataService(String pId) {
        BizIndustrialData temp = new BizIndustrialData();
        if(StringUtils.isBlank(pId)){
            temp.setParentId("0");
        }else{
            temp.setParentId(pId);
        }
        return bizIndustrialDataMapper.selectBizIndustrialDataList(temp);
    }

    /**
     * @return
     */
    @Override
    public List<BizIndustrialData> selectIndustrialAllData() {
        return bizIndustrialDataMapper.selectBizIndustrialDataList(new BizIndustrialData());
    }

    /**
     * @return
     */
    @Override
    public AjaxResult getTree() {
        BizIndustrialData params = new BizIndustrialData();
        params.setParentId("0");
        List<BizIndustrialData> bizIndustrialData = bizIndustrialDataMapper.selectBizIndustrialDataList(params);

        return AjaxResult.success(bizIndustrialData);
    }
}
